package tutorial.lite_mod.activity_sign;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import public_util.model.Const4PublicDataBase;
import public_util.model.ReturnData;
import public_util.servlet.ServletParent;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 用来提供特殊接口给当前的小模式使用
 */
@Controller("/application_4_lite_mod_activity_sign")
public class Tutorial4LiteModServlet extends ServletParent {

    private static final long serialVersionUID = 1L;
    private static Logger logger = Logger.getLogger(Tutorial4LiteModServlet.class);




    /**
     * @see HttpServlet#HttpServlet()
     */
    public Tutorial4LiteModServlet() {
        super();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }



    /**
     */
    @RequestMapping("/application_4_lite_mod_activity_sign")
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        String methodName = request.getParameter(Const4PublicDataBase.PARA_invoke_method);
        if (methodName!= null)
        {
            logger.info("--2--");
            super.doPost(request, response);
            return;
        }
        logger.info("--1--");

        //--提前打印出来
        ReturnData data  = new ReturnData();

        data.setStatus(0);
        printRes(response, data);
    }


    /**
     * 测试URL: application_4_lite_mod_activity_sign?invoke_method=show_test_demo&time=1000
     */
    public void show_test_demo(HttpServletRequest request, HttpServletResponse response) {
        ReturnData data =new ReturnData();
        data.setMsg("application_4_lite_mod_admin_power--->show_test_demo");
        data.setStatus(0);
        printRes(response, data);
    }

}